from __future__ import annotations

from dataclasses import dataclass


@dataclass
class AntiTwistResult:
    torque_Nm: float
    ok: bool
    note: str


def check_anti_twist(diameter_mm: float, tension_kN: float, torsion_coeff_Nm_per_kNmm: float = 0.02, device_capacity_Nm: float = 500.0) -> AntiTwistResult:
    """防扭验算：近似扭矩 = 系数×张力×直径。"""

    torque = torsion_coeff_Nm_per_kNmm * tension_kN * diameter_mm
    ok = torque <= device_capacity_Nm
    return AntiTwistResult(torque_Nm=torque, ok=ok, note="系数随导线结构而异，按厂家参数修正")


